package com.ayf.payment.game.api.service.platform.impl;

import com.ayf.payment.game.api.dto.platform.NetRateViewDTO;
import com.ayf.payment.game.api.entity.platform.NetRateView;
import com.ayf.payment.game.api.mapper.platform.NetRateViewMapper;
import com.ayf.payment.game.api.service.platform.NetRateViewService;
import com.swwx.charm.commons.lang.utils.BeanConvertUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class NetRateViewServiceImpl implements NetRateViewService {

    @Resource
    private NetRateViewMapper netRateViewMapper;

    @Override
    public List<NetRateViewDTO> list() {
        return BeanConvertUtils.convert(netRateViewMapper.selectAll(), NetRateViewDTO.class);
    }

    @Override
    public void update(List<NetRateViewDTO> list) {
        for (NetRateViewDTO viewDTO : list) {
            NetRateView view = BeanConvertUtils.convert(viewDTO, NetRateView.class);
            netRateViewMapper.updateByPrimaryKeySelective(view);
        }
    }
}
